//package com.bestcem.xm.common.core.config.mybatis.typehandler;
//
//
//import org.apache.ibatis.type.BaseTypeHandler;
//import org.apache.ibatis.type.JdbcType;
//import org.apache.ibatis.type.MappedJdbcTypes;
//import org.apache.ibatis.type.MappedTypes;
//
//import java.sql.*;
//import java.time.LocalTime;
//
///**
// * ShardingSphere不支持getObject，需要自定义LocalTime类型转换（参照mybatis-typehandlers-jsr310 v1.0.2）
// *
// * @author zhangfeng <feng.zhang@idiaoyan.com>
// * @version v1.0
// * @date 2021/9/14 17:19
// */
//@MappedTypes(LocalTime.class)
//@MappedJdbcTypes(value = JdbcType.TIME, includeNullJdbcType = true)
//public class LocalTimeTypeHandler extends BaseTypeHandler<LocalTime> {
//
//    @Override
//    public void setNonNullParameter(PreparedStatement ps, int i, LocalTime parameter, JdbcType jdbcType)
//            throws SQLException {
//        ps.setTime(i, Time.valueOf(parameter));
//    }
//
//    @Override
//    public LocalTime getNullableResult(ResultSet rs, String columnName) throws SQLException {
//        Time time = rs.getTime(columnName);
//        return getLocalTime(time);
//    }
//
//    @Override
//    public LocalTime getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
//        Time time = rs.getTime(columnIndex);
//        return getLocalTime(time);
//    }
//
//    @Override
//    public LocalTime getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
//        Time time = cs.getTime(columnIndex);
//        return getLocalTime(time);
//    }
//
//    private static LocalTime getLocalTime(Time time) {
//        if (time != null) {
//            return time.toLocalTime();
//        }
//        return null;
//    }
//}
